package com.ycy.chuwenuniapp.controller;

import com.ycy.chuwenuniapp.common.ResData;
import com.ycy.chuwenuniapp.dto.GoodsTypeDto;
import com.ycy.chuwenuniapp.entity.User;
import com.ycy.chuwenuniapp.service.LoginService;
import com.ycy.chuwenuniapp.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags = "用户管理")
@RequestMapping("/user")
@RestController
public class UserController {
    @Resource
    private UserService userService;

    @PostMapping("/save")
    @ApiOperation("新增或修改")
    public ResData<Boolean> saveUser(@RequestBody User entity) {
        return userService.saveUser(entity);
    }

    @GetMapping("/findOne")
    @ApiOperation("获取用户信息")
    public ResData<User> findOne(String userId) {
        return userService.findOne(userId);
    }
}
